//
// Created by wenxin on 7/15/20.
//
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/io/ply_io.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <unistd.h>
#include <string>
#ifndef TREEPOINT_READPLYFILE_H
#define TREEPOINT_READPLYFILE_H
pcl::PointCloud<pcl::PointXYZ>::Ptr readPly(std::string filePath ){
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);

    if (pcl::io::loadPLYFile<pcl::PointXYZ>(filePath, *cloud) == -1) //* load the file
    {
        PCL_ERROR("文件读取失败！ \n");
    }
    //pcl::StatisticalOutlierRemoval::applyFileter()
//    for (size_t i = 0; i < cloud->points.size (); ++i) {
//        std::cout << "    " << cloud->points[i].x
//                  << " " << cloud->points[i].y
//                  << " " << cloud->points[i].z << std::endl;
//    }

    return cloud;

}
#endif //TREEPOINT_READPLYFILE_H
